#include "app_message.h"
#include "log/log.h"

int main(int argc, char const *argv[])
{
    char *json = "{\"id\":\"5858\",\"msg\":\"61626364\", \"conn_type\":1}";

    Message *message = app_message_initByJson(json);
    char buf[20];
    int len = app_message_toBinary(message, buf, sizeof(buf));
    log_debug("binary: %.*s, len=%d", len, buf, len);

    Message *message2 = app_message_initByBinary(buf, len);
    char json2[100];
    int len2 = app_message_toJson(message2, json2, sizeof(json2));
    log_debug("json: %s, len2=%d", json2, len2);

    return 0;
}
